package com.rritw.webtools.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class EmailUtil {

    private static final String  check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
    private static final Pattern regex = Pattern.compile(check);

    /**
     * 判断给定的Email是否合法
     * 
     * @param email
     * @return
     */
    public static boolean isEmail(String email) {
        if (StringUtil.isEmpty(email)) {
            return Boolean.FALSE;
        }
        Matcher matcher = regex.matcher(email);
        return matcher.matches();
    }
}
